﻿using System;

using LeanEngine.Data.Linq.Language;

namespace LeanEngine.Data.Linq.Builder
{
    internal struct QueryBuilderFacade
    {
        internal static IQueryBuilder GetQueryBuilder(SelectToken select)
        {
            if (select.Count)
            {
                return new CounterQueryBuilder();
            }
            else if (select.PageSize > 0)
            {
                return new PagedQueryBuilder() { PageIndex = select.PageIndex, PageSize = select.PageSize };
            }
            else
            {
                return new StatementBuilder();
            }            
        }
    }
}
